//轮播图插件
var mySwiper = new Swiper('.swiper-container', {
	autoplay: {
		delay: 2000,
		disableOnInteraction: false,
	}, //可选选项，自动滑动
	loop: true,
	//箭头
	navigation: {
		nextEl: '.swiper-button-next',
		prevEl: '.swiper-button-prev',
	},
})

$(function() {
	var countCXArr = [];
	var countCX = function() {
		$('.numCount').each(function(i, dom) {
			if (countCXArr[i] && countCXArr[i] === true) {
				return;
			}
			var sT;
			var ncTop;
			sT = $(window).scrollTop();
			ncTop = $(dom).offset().top;
			var id, decimals, startVal, endVal, duration;
			if (sT > ncTop - $(window).height() && sT < ncTop) {
				$(dom).find('.numCX').each(function() {
					id = $(this).attr('id');
					decimals = $(this).attr('data-decimals'),
						startVal = $(this).attr('data-startVal'),
						endVal = $(this).attr('data-endVal'),
						duration = $(this).attr('data-speed');
					new CountUp(id, startVal, endVal, decimals, duration, {
							useEasing: true, //效果
							separator: '' //数字分隔符
						})
						.start(); // target：目标元素id, startVal：你想要开始的值, endVal：你想要到达的值, decimals：小数位数，默认值为0, duration：动画持续时间为秒，默认值为2, options：选项的可选对象
					countCXArr[i] = true;
				})
			}
		})
	}
	countCX();
	$(window).on("scroll", function() {
		countCX();
	})
});
//百度地图
var map = new BMapGL.Map('newMap', {
	minZoom: 16,
	maxZoom: 20,
});
map.enableScrollWheelZoom(true);
//通过获取当前坐标点，来初始化地图
var geolocation = new BMapGL.Geolocation();
geolocation.getCurrentPosition(function(r) {
	if (this.getStatus() == BMAP_STATUS_SUCCESS) {
		map.centerAndZoom(r.point, 18);
		var mk = new BMapGL.Marker(r.point);
		map.addOverlay(mk);
		// alert('您的位置：'+r.point.lng+','+r.point.lat);
	} else {
		// alert('failed'+this.getStatus());
	}
});

map.centerAndZoom("116.498568,39.906029", 19);
map.setDisplayOptions({
	// poiText: false,
	poiIcon: false,
})
map.setHeading(64.5);
map.setTilt(200);
var circle = new BMapGL.Circle(new BMapGL.Point(116.498568, 39.906029), 10, {
	strokeColor: 'red',
	strokeWeight: 2,
	strokeOpacity: 0.5
});
map.addOverlay(circle);
// 添加比例尺控件
var scaleCtrl = new BMapGL.ScaleControl(); // 添加比例尺控件
map.addControl(scaleCtrl);



